package com.ncss.http.proxy.server;

import com.ncss.http.proxy.server.handler.HttpClientHandler;

import java.net.ServerSocket;
import java.net.Socket;

public class HttpProxyServer {

    public void start() throws Exception {
        System.out.println("start server..");
        ServerSocket ss = new ServerSocket(8888);
        while (true) {
            try {
                Socket socket = ss.accept();
                new Thread(new HttpClientHandler(socket)).start();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

    }

    public static void main(String[] args) throws Exception {
        HttpProxyServer server = new HttpProxyServer();
        server.start();
    }
}
